
class Car:
    def run(self, speed):
        print(self.color, '的', self.brand, self.mode,
              '正在以', speed, '公里每小时的速度飞驰')

car1 = Car()  # 创建了一个车对象
car1.color = '红色'  # 颜色, 为car1添加一个color属性,记录车的颜色
car1.brand = '比亚迪'  # 品牌
car1.mode = '汉EV'  # 型号
# car1 = dict(
#     color='红色',  # 颜色
#     brand = '比亚迪',  # 品牌
#     mode = '汉EV'  # 型号
# )
car2 = Car()                            # 课间休息: 16:17 回来
car2.color = '白色'
car2.brand = '宝马'
car2.mode = 'X5'
# car2 = dict(
#     color = '白色',
#     brand = '宝马',
#     mode = 'X5'
# )

#Car.car_run(car1, 120)
car1.run(120)
car2.run(230)
# Car.car_run(car2, 230)

